/**
 * Copyright 2009 Erick Armbrust 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */

package tapioca.dt;

import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;

/**
 * A simple data object stored that tracks the state of any object manipulated in a distributed
 * transaction.
 *
 * @author armbrust@gmail.com (Erick Armbrust)
 */
class CacheRecord {

  private final Key key;
  private Entity entity;
  private boolean inserted;
  private boolean created;
  private boolean retrieved;
  private boolean deleted;
  private Key version;
  
  CacheRecord(Key key) {
    this.key = key;
  }

  public Key getKey() {
    return key;
  }    
  
  public Entity getEntity() {
    return entity;
  }

  public void setEntity(Entity entity) {
    this.entity = entity;
  }
  
  public boolean isInserted() {
    return inserted;
  }

  public void setInserted(boolean inserted) {
    this.inserted = inserted;
  }

  public boolean isCreated() {
    return created;
  }

  public void setCreated(boolean created) {
    this.created = created;
  }

  public boolean isRetrieved() {
    return retrieved;
  }

  public void setRetrieved(boolean retrieved) {
    this.retrieved = retrieved;
  }

  public boolean isDeleted() {
    return deleted;
  }

  public void setDeleted(boolean deleted) {
    this.deleted = deleted;
  }

  public Key getVersion() {
    return version;
  }

  public void setVersion(Key version) {
    this.version = version;
  }  
  
}
